package com.ruoyi.yljc.controller;

import java.util.List;
import javax.annotation.Generated;
import javax.servlet.http.HttpServletResponse;


import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yljc.domain.Rlzy;
import com.ruoyi.yljc.service.IRlzyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 人力资源Controller
 *
 * @author y
 * @date 2022-03-16
 */
@RestController
@RequestMapping("/yljc/rlzy")
public class RlzyController extends BaseController
{
    @Autowired
    private IRlzyService rlzyService;

    /**
     * 查询人力资源列表
     */
    @ResponseBody
    @PreAuthorize("@ss.hasPermi('yljc:rlzy:list')")
    @GetMapping("/list")
    public TableDataInfo list(Rlzy rlzy)
    {
        startPage();
        List<Rlzy> list = rlzyService.selectRlzyList(rlzy);
        return getDataTable(list);
    }

    /**
     * 导出人力资源列表
     */
    @PreAuthorize("@ss.hasPermi('yljc:rlzy:export')")
    @Log(title = "人力资源", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Rlzy rlzy)
    {
        List<Rlzy> list = rlzyService.selectRlzyList(rlzy);
        ExcelUtil<Rlzy> util = new ExcelUtil<Rlzy>(Rlzy.class);
        util.exportExcel(response, list, "人力资源数据");
    }

    /**
     * 获取人力资源详细信息
     */
    @PreAuthorize("@ss.hasPermi('yljc:rlzy:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(rlzyService.selectRlzyById(id));
    }

    /**
     * 新增人力资源
     */
    @PreAuthorize("@ss.hasPermi('yljc:rlzy:add')")
    @Log(title = "人力资源", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Rlzy rlzy)
    {
        return toAjax(rlzyService.insertRlzy(rlzy));
    }

    /**
     * 修改人力资源
     */
    @PreAuthorize("@ss.hasPermi('yljc:rlzy:edit')")
    @Log(title = "人力资源", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Rlzy rlzy)
    {
        return toAjax(rlzyService.updateRlzy(rlzy));
    }

    /**
     * 删除人力资源
     */
    @PreAuthorize("@ss.hasPermi('yljc:rlzy:remove')")
    @Log(title = "人力资源", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(rlzyService.deleteRlzyByIds(ids));
    }


}
